package cn.tedu.ivos.audit.controller;

import cn.tedu.ivos.audit.pojo.dto.AuditSaveParam;
import cn.tedu.ivos.audit.pojo.dto.AuditSaveParam1;
import cn.tedu.ivos.audit.pojo.vo.AuditVo;
import cn.tedu.ivos.audit.service.AuditService;
import cn.tedu.ivos.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/audit")
@Slf4j
public class AuditController {
    @Autowired
    AuditService auditService;
    @GetMapping("/select")
    public JsonResult selectAudit(AuditSaveParam auditSaveParam){
        log.debug("查询审批单: {}",auditSaveParam);
        List<AuditVo> audits= auditService.selectAudit(auditSaveParam);
        log.debug("查询审批单业务返回: {}",audits);
        return JsonResult.ok(audits);
    }
    @PostMapping("/update")
    public JsonResult updateAudit(AuditSaveParam1 auditSaveParam1){
        log.debug("更新审批单: {}",auditSaveParam1);
        auditService.updateAudit(auditSaveParam1);
        return JsonResult.ok();
    }
}
